
<html lang="en">
<head>
    <#include "../common/header.ftl" />
    <script>
        $(function () {
            //发布/拒绝按钮
            $(".btn-state").click(function () {
                //获取游记id
                var id = $(this).data('id');
                //获取要修改的状态
                var state = $(this).data('state');
                $.get('/travel/updateState.do',{id:id,state:state},function (data) {
                     handleMessage(data)
                })
            })

            //查看文章按钮
            $(".btn-look").click(function () {
                //获取游记id
                var id = $(this).data('id');
                $.get('/travel/getContentById.do',{id:id},function (data) {
                    $("#inputModal .modal-body").html(data.content);
                    $("#inputModal").modal('show');
                })
            })
        })
    </script>
    <style>
        .modal-body img{
            width: 100%;
        }
    </style>
</head>
<body>

<div class="container " style="margin-top: 20px">
    <#include "../common/top.ftl" />
    <div class="row">
    <div class="col-sm-3">
        <!--菜单回显-->
         <#assign currentMenu="travel"/>
        <#include "../common/menu.ftl" />
        <!--设置菜单回显-->
    </div>
    <div class="col-sm-9">
        <div class="row">
            <div class="col-sm-12">
                <h1 class="page-head-line">待审核游记列表</h1>
            </div>
        </div>
        <!--高级查询--->
        <form class="form-inline" id="searchForm" action="/travel/list.do" method="post">
            <input type="hidden" name="currentPage" id="currentPage" value="1">
            <div class="form-group">
               <select class="form-control" name="state" id="stateSelect" >
                   <option value="1">待审核</option>
                   <option value="-1">已拒绝</option>
               </select>
                <script>
                    $("#stateSelect").val(${(qo.state)!});
                </script>
            </div>
            <input type="submit" id="btn_query" class="btn btn-success btn-default" value="查询">
        </form>

        <table class="table table-striped table-hover">
            <thead>
            <tr>
                <th>编号</th>
                <th>标题</th>
                <th>封面</th>
                <th>地点</th>
                <th>作者</th>
                <th>状态</th>
                <th>操作</th>
            </tr>
            </thead>

            <#list pageInfo.list as entity>
                <tr>
                    <td>${entity_index+1}</td>
                    <td>${entity.title}</td>
                    <td><img src="${entity.coverUrl}" width="50px"/></td>
                    <td>${entity.place.name}</td>
                    <td>${entity.author.nickName}</td>
                    <td>${entity.stateName}</td>
                    <td>
                        <a class="btn btn-success btn-sm btn-state" data-id="${entity.id}" data-state="2">
                            <span class="glyphicon glyphicon-ok-circle"></span>发布
                        </a>

                        <a class="btn btn-danger btn-sm btn-state" data-id="${entity.id}" data-state="-1">
                            <span class="glyphicon glyphicon-remove-circle"></span>拒绝
                        </a>

                        <a class="btn btn-primary btn-sm btn-look" data-id="${entity.id}">
                            <span class="glyphicon glyphicon-eye-open"></span>查看文章
                        </a>
                    </td>
                </tr>
            </#list>

        </table>
            <#include "../common/page.ftl" />

        </div>
</div>
</div>

<div class="modal fade" id="inputModal" tabindex="-1" role="dialog">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span>
                </button>
                <h4 class="modal-title">查看文章内容</h4>
            </div>
            <div class="modal-body">

            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div><!-- /.modal -->

</body>
</html>